import { createRouter, createWebHistory } from 'vue-router'
import login from '@/views/login/index.vue'
import layout from '@/views/layout/index.vue'
import home from '@/views/home/index.vue'
import overview from '@/views/overview/index.vue'
import productManager from '@/views/productManager/index.vue'
import userManager from '@/views/userManager/index.vue'
import messageManager from '@/views/messageManager/index.vue'
import userList from '@/views/userList/index.vue'
import messageList from '@/views/messageList/index.vue'
import recycleBin from '@/views/recycleBin/index.vue'

import productList from '@/views/productList/index.vue'
import outboundLlist from '@/views/outboundLlist/index.vue'

import contractManagement from '@/views/contractManagement/index.vue'
import operationLog from '@/views/operationLog/index.vue'
import loginLog from '@/views/loginLog/index.vue'

import set from '@/views/set/index.vue'
const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: login
  },
  {
    path: '/layout',
    name: 'layout',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    redirect: '/home',
    component: layout,
    children: [
      {
        path: '/home',
        name: 'home',
        component: home
      },

      {
        path: '/overview',
        name: 'overview',
        component: overview
      },

      {
        path: '/productManager',
        name: 'productManager',
        component: productManager
      },
      {
        path: '/userManager',
        name: 'userManager',
        component: userManager
      },
      {
        path: '/messageManager',
        name: 'messageManager',
        component: messageManager
      },
      {
        path: '/userList',
        name: 'userList',
        component: userList
      },

      {
        path: '/productList',
        name: 'productList',
        component: productList
      },
      {
        path: '/outboundLlist',
        name: 'outboundLlist',
        component: outboundLlist
      },

      {
        path: '/messageList',
        name: 'messageList',
        component: messageList
      },
      {
        path: '/recycleBin',
        name: 'recycleBin',
        component: recycleBin
      },

      {
        path: '/contractManagement',
        name: 'contractManagement',
        component: contractManagement
      },
      {
        path: '/operationLog',
        name: 'operationLog',
        component: operationLog
      },
      {
        path: '/loginLog',
        name: 'loginLog',
        component: loginLog
      },

      {
        path: '/set',
        name: 'set',
        component: set
      },
    ]
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
